﻿
Partial Class CustomControls_EncabezadoModulo
    Inherits System.Web.UI.UserControl
    Private _IdPersona As String
    Public Property idPersona() As String
        Get
            Return _IdPersona
        End Get
        Set(ByVal value As String)
            _IdPersona = value
        End Set
    End Property
    Private _idVisita As String
    Public Property idVisita() As String
        Get
            Return _idVisita
        End Get
        Set(ByVal value As String)
            _idVisita = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack = False Then
                CargarDatos()
            End If
    End Sub
    Sub CargarDatos()
        Using bd As New BdHogaresDataContext
            'cargar visita
            Dim a = (From i In bd.Web_Visitas
                    Where i.idvisita = _idVisita
                    Select i.Visita).FirstOrDefault

            lblVisita.Text = a

            Dim b = (From i In bd.Web_Caracterizacionpersonas
                    Where i.idPersona = _IdPersona
                    Select i.consecutivopersona, i.Nombres, i.Apellidos, i.edadañoscumplidos, i.sexo, i.Web_FormularioIdentificacionHogar.CodCoba, i.Web_FormularioIdentificacionHogar.Web_Proyecto.CodigoProyecto).FirstOrDefault

            lblNombre.Text = b.Nombres & " " & b.Apellidos
            lblCodigoCoba.Text = b.CodCoba
            lblCodigoProyecto.Text = b.CodigoProyecto
            lblConsecutivoPersona.Text = b.consecutivopersona
            LblEdad.Text = b.edadañoscumplidos
            lblSexo.Text = If(b.sexo = 1, "Hombre", "Mujer")

        End Using
    End Sub
End Class
